// https://www.luogu.com.cn/problem/P2016
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
using ll = long long;
const int inf = 0x3f3f3f3f;
#define rf(i, n) for (int i = 1; i <= (n); ++i)
int rad();  // read int
const int max_size = 5 + 100;
const int maxn = 5 + 1500;

int n;
int f[maxn][2];
vector<int> tr[maxn];
int dfs(int now, int fa, bool ch) {
    if (f[now][ch]) return f[now][ch];
    int cnt = ch;
    if (ch) {
        for (auto &p : tr[now])
            if (p != fa)
                cnt += min(dfs(p, now, 0), dfs(p, now, 1));
    } else {
        for (auto &p : tr[now])
            if (p != fa)
                cnt += dfs(p, now, 1);
    }
    return f[now][ch] = cnt;
}

int main() {
    n = rad();
    rf(i, n) {
        int l = rad() + 1, cnt = rad();
        while (cnt--) {
            int r = rad() + 1;
            tr[l].push_back(r), tr[r].push_back(l);
        }
    }
    printf("%d", min(dfs(1, 0, 0), dfs(1, 0, 1)));
}

int rad() {
    int back = 0, ch = 0, neg = 0;
    for (; ch < '0' || ch > '9'; ch = getchar())
        neg = ch == '-';
    for (; ch >= '0' && ch <= '9'; ch = getchar())
        back = (back << 1) + (back << 3) + (ch & 0xf);
    return (back ^ -neg) + neg;
}